#include "led.h"
#include "light.h"
#include <stdio.h>

int led_on(struct led *self);
int led_off(struct led *self);
int led_get_state(struct led *self);

struct light_i led_interface = {
        .on = (light_on_fn_t)led_on,
        .off = (light_off_fn_t)led_off,
        .get_state = (light_get_state_fn_t)led_get_state,
};

int led_on(struct led *self){
        //
        printf("led is on\r\n");
        self->state = 1;
        return 0;
}

int led_off(struct led *self){
        printf("led is off\r\n");
        self->state = 1;
        //
        return 0;
}

int led_get_state(struct led *self){
        return self->state;
}

int led_init(struct led *self){
        self->state = 0;
        self->interface = &led_interface;
        return 0;
}